//
//  ByDocumentaryOtherCell.m
//  caipiao_ios
//
//  Created by mc on 2018/7/27.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByDocumentaryOtherCell.h"

@implementation ByDocumentaryOtherCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByDocumentaryOtherCell";
    ByDocumentaryOtherCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        UILabel *line = [[UILabel alloc] init];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(0);
            make.right.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.height.mas_equalTo(@1);
        }];
        line.backgroundColor = BY_LINE_COLOR;
        [self initViews];
        
    }
    return self;
}


- (void)initViews{
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    UIButton *bettingBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:bettingBtn];
    [bettingBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-10);
        make.bottom.equalTo(self.contentView).offset(-5);
        make.size.mas_equalTo(CGSizeMake(70, 25));
    }];
    [bettingBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [bettingBtn setTitle:@"立即跟单" forState:UIControlStateNormal];
    bettingBtn.backgroundColor = BY_THEME_COLOR;
    bettingBtn.titleLabel.font = FONT(12);
    bettingBtn.layer.cornerRadius = 5;
    
    UILabel *moneyLabel = [[UILabel alloc] init];
    [self.contentView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.centerY.equalTo(bettingBtn.mas_centerY).offset(0);
        make.right.equalTo(bettingBtn.mas_left).offset(-10);
        make.height.mas_equalTo(@15);
    }];
    moneyLabel.font = FONT(12);
    moneyLabel.text = @"自购100.00元 跟单10人";
    moneyLabel.textColor = [UIColor blackColor];
    
    UILabel *notesLabel = [[UILabel alloc] init];
    [self.contentView addSubview:notesLabel];
    [notesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(moneyLabel.mas_left).offset(0);
        make.bottom.equalTo(moneyLabel.mas_top).offset(-5);
        make.size.mas_equalTo(CGSizeMake(150, 15));
    }];
    notesLabel.font = FONT(12);
    notesLabel.text = @"竞彩足球精选方案";
    notesLabel.textColor = [UIColor blackColor];
    notesLabel.textAlignment = NSTextAlignmentLeft;
    
    
    UILabel *minLabel = [[UILabel alloc] init];
    [self.contentView addSubview:minLabel];
    [minLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bettingBtn.mas_right).offset(0);
        make.top.equalTo(self.contentView).offset(0);
        make.size.mas_equalTo(CGSizeMake(70, 15));
    }];
    minLabel.font = FONT(12);
    minLabel.text = @"2元起投";
    minLabel.textColor = [UIColor lightGrayColor];
    minLabel.textAlignment = NSTextAlignmentRight;
    
    
    UILabel *timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(minLabel.mas_left).offset(-10);
        make.height.mas_equalTo(@15);
        make.top.equalTo(self.contentView).offset(0);
    }];
    timeLabel.textColor = [UIColor lightGrayColor];
    timeLabel.font = FONT(12);
    timeLabel.text = @"竞彩足球 2018-06-26 10:50:00";
    timeLabel.textAlignment = NSTextAlignmentLeft;
    
    self.timeLabel = timeLabel;
    self.minLabel = minLabel;
    self.moneyLabel = moneyLabel;
    
}



@end
